navigationGo.pngQuick Navigation
allprojects32.pngAll projects
hardware32.pngHardware
links32.pngLinks

favoriteStar32.pngTop projects
Alan numitron clock
Clapclap 2313/1386
SNES Pi Webserver
USB Volume/USB toys
Smokey amp
Laser cutter
WordClock
ardReveil v3
SNES Arcade cabinet
Game boy projects
cameleon
Home Presence Detector

github32.pngGitHub
AlanFromJapan

navigationMail.pngContact me

alanfjmail.png
3flags.pngWho's Alan?


Akizukidenshi
Elec-lab
Rand Nerd Tut
EEVblog
SpritesMods
AvrFreaks
Gameboy Dev
FLOZz' blog
Switch-science
Sparkfun
Suzusho
Datasheet Lib
Reddit Elec
Ermicro
Carnet du maker (fr)

another raspi webradio player

Last update: Thu Jun 5 22:25:40 2025
This is a new Template for another raspi webradio player!

Presentation

Principle

Points of interrest

Implementation

Installation

#Start with a fresh Raspberry pi OS

sudo apt update
sudo apt upgrade

#get the screen to work
sudo apt install git emacs-nox libxi6
git clone https://github.com/waveshare/LCD-show.git
cd LCD-show/
./LCD35-show

reboot
#test the screen
cat /dev/urandom >/dev/fb0

#get pygame
sudo apt install python3-pip 
sudo pip3 install pygame

#get SDL library 1.2 (https://www.impulseadventure.com/elec/rpi-install-sdl.html)
sudo apt-get install libsdl1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev

#VLC and pulseaudio
sudo apt-get install vlc pulseaudio

Testing

Run that file AS SUDOER:
import pygame
import sys
import time
import os


drivers = ['directfb', 'fbcon', 'svgalib']

found = False
for driver in drivers:
    if not os.getenv('SDL_VIDEODRIVER'):
        os.putenv('SDL_VIDEODRIVER', driver)
    try:
        pygame.display.init()
    except pygame.error:
        print ('Driver: {0} failed.'.format(driver))
        continue
    found = True
    break

if not found:
   raise Exception('No suitable video driver found!')


pygame.init()

size = (pygame.display.Info().current_w, pygame.display.Info().current_h)
black = 0, 0, 0

screen = pygame.display.set_mode(size)


screen.fill(black)
pygame.display.flip()

time.sleep(5)

Bill of materials

Schematics

Source code

Pictures

Links

Helpful sources

  • Tutorial https://learn.adafruit.com/pi-video-output-using-pygame/getting-started
  • run without root
  • use the directFB
  • Inspiration

    All content on this site is shared under the MIT licence (do what u want, don't sue me, hat tip appreciated)
    electrogeek.tokyo ~ Formerly known as Kalshagar.wikispaces.com and electrogeek.cc (AlanFromJapan [2009 - 2025])